<template>
	<view class="home-content">
		<image src="https://pic.imgdb.cn/item/630580a016f2c2beb137e7c4.png" mode="widthFix" class="top-bg"></image>
		<CustomNav :custom="custom" title="详情" :isBack="true" backColor="#fff" :topBgColor="topBgColor" :color="'#fff'">
		</CustomNav>
		<view :style="'margin-top:'+(custom.statusBar+custom.nvaMartom+custom.navHeight+40)+'rpx'" class="detail-block">
			<mp-html :content="detail.exposureContent" v-if="detail.exposureContent"></mp-html>
			<view style="text-align: center;" v-else>暂无详情</view>
		</view>
	</view>
</template>

<script>
	import {
		getExposureByIdApi
	} from '@/api/lighthouse.js'
	export default {
		data() {
			return {
				custom: null,
				topBgColor: 'rgba(0,0,0,0)',
				detail: {
					exposureContent: ''
				}
			}
		},
		methods: {
			getList(id) {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getExposureByIdApi({
					id
				}).then(data => {
					uni.hideLoading()
					this.detail = data
					console.log(this.detail)
				}).catch(() => {
					uni.hideLoading()
				})
			}
		},
		onPageScroll(e) {
			if (e.scrollTop >= 1) {
				//this.topBgColor='linear-gradient(to right,#656ef9,#7f3ee4)'
				this.topBgColor = '#086df3'
			} else {
				this.topBgColor = 'rgba(0,0,0,0)';
			}
		},
		onLoad(e) {
			this.custom = this.utils.getCustomNavData();
			this.getList(e.id)
		}
	}
</script>

<style lang="scss" scoped>
	.home-content {
		overflow: hidden;

		.top-bg {
			width: 100%;
			position: absolute;
		}

		.detail-block {
			min-height: 80vh;
			position: relative;
			width: calc(100% - 40rpx);
			margin: 0 auto;
			padding: 30rpx;
			background: #fff;
			border-radius: 12rpx;
			box-shadow: 0 0 10px 0px #e8e8e8;
			margin-bottom: 30rpx;
			line-height: 2;
			font-size: 28rpx;
			text-align: justify;
			text-indent: 56rpx;
		}
	}
</style>